home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
turbovis
/
tvtool17.zip
/
TVTOOLS.DOC
< prev
next >
Wrap
Text File
|
1993-10-25
|
12KB
|
376 lines
/***
Module : TVTOOLS
Description : Various tools and addings for TV
New operators: TMenuItem = TMenuItem + TMenuItem
============= TMenuItem += TMenuItem
TSItem = TSItem + TSItem
TSItem += TSItem
TSubMenu += TSubMenu
TSubMenu += TMenuItem
TStatusDef += TStatusDef
TStatusDef += TStatusItem
General List:
============
TGenCollection: Same as TStringCollection
TGenCollection( ccIndex = 0, ccIndex = 0 );
but with two output functions:
char *getData( ccIndex ); // to return the data
char *getText( ccIndex ); // to display text in a viewer
By default, getData() calls getText().
These functions have to be used in place of TStringCollection ones
and can be overloaded:
ccIndex indexOf( char *item ); // data index
ccIndex indexOfText( char *item ); // text index
int getCount(); // returns number of items
int getTextLength(); // returns maximum length of text
int compare( void *, void * ); // function to compare to items
void *firstThat( ccTestFunc Test, void *arg ); // search
void *firstTextThat( ccTestFunc Test, void *arg ); // search
All these virtual functions are designed to work as is with
TStringCollection lists. The functions you need to overload to use
another list mechanism are:
getData(), getText(), getCount()
The other ones use these three ones.
Default compare() is case-insensitive (also éàÅ,... are treated as
normal letters).
ComboBox:
========
TComboBox: Pop-up box with a list viewer.
Must be linked with a TInputLine (or TStaticInputLine) and a
TGenCollection.
When pressing characters, the first list item matching these
characters is focused. If a non matching character is pressed,
a buzzer sound is output.
Enter or double-click is used to select an item.
The corresponding data will so be given to the TInputLine.
TComboBox( const TRect&, TInputLine *, TGenCollection * );
TComboBox( TInputLine *, TGenCollection * ); // Right of line
New Input fields:
================
TInput1Line( x, y, len )
T1StaticText( x, y, string ): same as TStaticText
TStaticTextf( const TRect& bounds, const char *fmt, ... )
TStaticTextf( const ushort x, const ushort y, const char *fmt, ... )
same as TStaticText but allows same syntax as printf()
T1Label( x, y, string, link )
TInputKey: Same as TInputLine, except invalid if empty
TInputKey( const TRect&, int len );
TInputKey( int x, int y, int len );
TInputPasswd: Same as TInputLine, but display only '*'
TInputPasswd( const TRect&, int len );
TInputPasswd( int x, int y, int len );
TInputRegExp: Same as TInputLine, but filter input to be in a 'set' and
check result to match the regular expression 'regexp'. If
UPPER or LOWER is given as last parameter, all characters
are translate into upper/lowercase (also éàÅ,...).
If an invalid character is pressed, a buzzer sound is
output. If input does not match the regular expression, a
messageBox is output at valid() time. This message may be
replaced or disabled (0).
char *invMsg = " \n\03Invalid entry !";
'set' and 'regexp' comply with UNIX-grep regular expressions;
ex: set = "0-9a-z+-*/" or "^0-9"
regexp = "[0-9]*.[a-zA-Z]*..*"
'set' and 'regexp' can be nul (0 or not given).
TInputRegExp( const TRect&, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
TInputRegExp( int x, int y, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
TInputInt: Accepts only valid numeric input (int) between Min and Max.
If a wrong character is pressed, a buzzer sound is output.
TInputInt( const TRect&, int len = 7, int min = -MAXINT, int max = MAXINT );
TInputInt( int x, int y , int len = 7, int min = -MAXINT, int max = MAXINT );
TInputLong: Accepts only valid numeric input (long) between Min and Max.
If a wrong character is pressed, a buzzer sound is output.
TInputLong( const TRect&, int len = 12, long min = -MAXLONG, long max = MAXLONG );
TInputLong( int x, int y , int len = 12, long min = -MAXLONG, long max = MAXLONG );
TInputDouble: Accepts only valid numeric input between Min and Max.
If a wrong character is pressed, a buzzer sound is output.
TInputDouble( const TRect&, int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
TInputDouble( int x, int y , int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
TInputHexa: Accepts only valid hexadecimal string input.
If a wrong character is pressed, a buzzer sound is output.
TInputHexa( const TRect&, int len );
TInputHexa( int x, int y , int len );
TInputDate: Accepts only valid date input (or empty line).
If a wrong character is pressed, a buzzer sound is output.
TInputDate( const TRect& );
TInputDate( int x, int y );
TInputCalcul: Accepts a calculation string.
If a wrong character is pressed, a buzzer sound is output.
TInputCalcul( const TRect&, int len );
TInputCalcul( int x, int y, int len );
TStaticInputLine:
Same as TInputLine, but input must match a TGenCollection list.
When pressing characters, the first list item matching these
characters is displayed. If a non matching character is
pressed, a buzzer sound is output. The left and right arrows
are used to cycle through items, Home & End to go to first &
last item (and the matching buffer is reset).
TStaticInputLine( TRect&, int len, TGenCollection *list );
TStaticInputLine( int x, int y, int len, TGenCollection *list );
New InputBox:
============
ushort inputPasswdBox( const char *Title, const char *aLabel, char *s, uchar limit );
ushort inputPasswdBoxRect( const TRect &bounds,
const char *Title,
const char *aLabel,
char *s,
uchar limit );
Misc:
====
ushort execDialog( TWindow *d, void *data );
- Execute a dialog box and returns entered values.
- Fields are pre-loaded with data values.
- If data is NULL, nothing is pre-loaded nor returned.
- If the dialog is cancelled, data is not modified.
- Dialog is destroyed before exiting.
- Return: command (cmCancel, cmYes,...)
void putCommand( ushort What, ushort Command );
- Put an event containing {What, Command}
void saveMouseState( void );
void restoreMouseState( void );
- Save/Restore mouse state (position)
appSystem( command );
- Suspend critical error handler,
- clears screen,
- perform a system call,
- resume critical error handler,
- redraws screen.
- If current drive is A: or B: and is not ready (not inserted or not
formatted), ask to insert a